Fixed Point Math

Fixed

function Fixed(S: Single): TFixed; overload;

function Fixed(I: Integer): TFixed; overload;

A couple of TFixed constructors.

In case you don't want your program to loose time on extra function call, you can use another method of converting Integer to TFixed:

var

  FX: TFixed;

begin

  FX := IntVal shl 16;

  ...

end;

FixedFloor

function FixedFloor(A: TFixed): Integer;

An analogue to Floor function.

FixedCeil

function FixedCeil(A: TFixed): Integer;

An implementation of the Ceil function for TFixed type.

FixedMul

function FixedMul(A, B, TFixed): TFixed;

This is the same as using MulDiv(A, B, $10000).

FixedDiv

function FixedDiv(A, B, TFixed): TFixed;

This is the same as using MulDiv(A, $10000, B).

FixedRound

function FixedRound(A, B, TFixed): TFixed;

Provides correct rounding of fixed-point values.

See Also

TFixed